Filename | (eval 1127)[/usr/share/perl/5.10/CGI.pm:869] |
Statements | Executed 60 statements in 134µs |
Eval Invoked At | /usr/share/perl/5.10/CGI.pm line 869 |
Sibling evals | 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23 |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
2 | 2 | 2 | 183µs | 2.04ms | url | CGI::
Line | State ments |
Time on line |
Calls | Time in subs |
Code |
---|---|---|---|---|---|
1 | # spent 2.04ms (183µs+1.86) within CGI::url which was called 2 times, avg 1.02ms/call:
# once (129µs+1.66ms) by main::RUNTIME at line 832 of CGI.pm
# once (54µs+194µs) by main::RUNTIME at line 629 of /usr/share/koha/opac/cgi-bin/opac/opac-search.pl | ||||
2 | 2 | 7µs | 2 | 8µs | my($self,@p) = self_or_default(@_); # spent 8µs making 2 calls to CGI::self_or_default, avg 4µs/call |
3 | 2 | 13µs | 2 | 108µs | my ($relative,$absolute,$full,$path_info,$query,$base,$rewrite) = # spent 108µs making 2 calls to CGI::Util::rearrange, avg 54µs/call |
4 | rearrange(['RELATIVE','ABSOLUTE','FULL',['PATH','PATH_INFO'],['QUERY','QUERY_STRING'],'BASE','REWRITE'],@p); | ||||
5 | 2 | 1µs | my $url = ''; | ||
6 | 2 | 2µs | $full++ if $base || !($relative || $absolute); | ||
7 | 2 | 800ns | $rewrite++ unless defined $rewrite; | ||
8 | |||||
9 | 2 | 10µs | 2 | 147µs | my $path = $self->path_info; # spent 138µs making 1 call to CGI::AUTOLOAD
# spent 8µs making 1 call to CGI::path_info |
10 | 2 | 9µs | 2 | 127µs | my $script_name = $self->script_name; # spent 120µs making 1 call to CGI::AUTOLOAD
# spent 7µs making 1 call to CGI::script_name |
11 | 2 | 12µs | 4 | 15µs | my $request_uri = unescape($self->request_uri) || ''; # spent 9µs making 2 calls to CGI::Util::unescape, avg 5µs/call
# spent 6µs making 2 calls to CGI::request_uri, avg 3µs/call |
12 | 2 | 9µs | 2 | 235µs | my $query_str = $self->query_string; # spent 176µs making 1 call to CGI::AUTOLOAD
# spent 59µs making 1 call to CGI::query_string |
13 | |||||
14 | 2 | 800ns | my $rewrite_in_use = $request_uri && $request_uri !~ /^\Q$script_name/; | ||
15 | 2 | 700ns | undef $path if $rewrite_in_use && $rewrite; # path not valid when rewriting active | ||
16 | |||||
17 | 2 | 900ns | my $uri = $rewrite && $request_uri ? $request_uri : $script_name; | ||
18 | 2 | 6µs | 2 | 1µs | $uri =~ s/\?.*$//s; # remove query string # spent 1µs making 2 calls to CGI::CORE:subst, avg 500ns/call |
19 | 2 | 1µs | $uri =~ s/\Q$ENV{PATH_INFO}\E$// if defined $ENV{PATH_INFO}; | ||
20 | # $uri =~ s/\Q$path\E$// if defined $path; # remove path | ||||
21 | |||||
22 | 2 | 1µs | if ($full) { | ||
23 | 2 | 9µs | 2 | 164µs | my $protocol = $self->protocol(); # spent 136µs making 1 call to CGI::AUTOLOAD
# spent 28µs making 1 call to CGI::protocol |
24 | 2 | 900ns | $url = "$protocol://"; | ||
25 | 2 | 8µs | 4 | 200µs | my $vh = http('x_forwarded_host') || http('host') || ''; # spent 156µs making 1 call to CGI::AUTOLOAD
# spent 44µs making 3 calls to CGI::http, avg 15µs/call |
26 | 2 | 6µs | 2 | 700ns | $vh =~ s/\:\d+$//; # some clients add the port number (incorrectly). Get rid of it. # spent 700ns making 2 calls to CGI::CORE:subst, avg 350ns/call |
27 | 2 | 2µs | if ($vh) { | ||
28 | $url .= $vh; | ||||
29 | } else { | ||||
30 | 2 | 5µs | 2 | 75µs | $url .= server_name(); # spent 73µs making 1 call to CGI::AUTOLOAD
# spent 2µs making 1 call to CGI::server_name |
31 | } | ||||
32 | 2 | 4µs | 2 | 4µs | my $port = $self->server_port; # spent 4µs making 2 calls to CGI::server_port, avg 2µs/call |
33 | 2 | 3µs | $url .= ":" . $port | ||
34 | unless (lc($protocol) eq 'http' && $port == 80) | ||||
35 | || (lc($protocol) eq 'https' && $port == 443); | ||||
36 | 2 | 700ns | return $url if $base; | ||
37 | 2 | 2µs | $url .= $uri; | ||
38 | } elsif ($relative) { | ||||
39 | ($url) = $uri =~ m!([^/]+)$!; | ||||
40 | } elsif ($absolute) { | ||||
41 | $url = $uri; | ||||
42 | } | ||||
43 | |||||
44 | 2 | 600ns | $url .= $path if $path_info and defined $path; | ||
45 | 2 | 1µs | $url .= "?$query_str" if $query and $query_str ne ''; | ||
46 | 2 | 400ns | $url ||= ''; | ||
47 | 2 | 8µs | 2 | 3µs | $url =~ s/([^a-zA-Z0-9_.%;&?\/\\:+=~-])/sprintf("%%%02X",ord($1))/eg; # spent 3µs making 2 calls to CGI::CORE:subst, avg 1µs/call |
48 | 2 | 10µs | return $url; | ||
49 | } | ||||
50 | |||||
51 | |||||
52 | ; |